from selenium import webdriver
from orm.session import get_session, get_engine
from orm.entity import to_cookies
from sqlalchemy import text

# 假设使用Chrome作为浏览器
driver = webdriver.Chrome()
engine = get_engine()
session = get_session()
url = 'https://javdb.com/tags?c10=1&c11=2024&c7=348'


if __name__ == "__main__":
    sql = text('TRUNCATE TABLE tb_cookie;')
    engine.connect().execute(sql)
    # 假设使用Chrome作为浏览器
    driver.get(url)
    # 保存
    # 断点打这里
    session.add_all(to_cookies(driver.get_cookies()))
    session.commit()
